<%@ page import="com.ecomm.themes.newstyle.functiontree.MenuGenerator,
com.ecomm.oa.accredit.AccreditAcl,
com.ecomm.oa.accredit.AccreditUtil,
java.util.Enumeration,
com.ecomm.security.functiontree.FunctionInfo,
com.ecomm.util.*"%>
<%@page contentType="text/html;charset=utf-8"%>
<%@include file="/include/currentuserinfo.jsp" %>
<%@include file="/include/filepath.jsp"%>
<html>
  <head>
    <meta http-equiv=content-type content="text/html; charset=utf-8">
    <link type="text/css" rel="stylesheet" href="<%=currentSkinCss%>" id="menuStyleSheet">
    <script type="text/javascript">
<!--

//点击页面菜单隐藏
document.onclick = function()
{
        if(window.top.hideAllMenuScriptlets)
        {
            window.top.hideAllMenuScriptlets();
        }
}
//-->
    </script>
    <script src="<%=ctxpath%>/chat/js/prototype.js" type="text/javascript"></script>
    <script src="<%=ctxpath%>/chat/js/ricobase.js" type="text/javascript"></script>
    <script src="<%=ctxpath%>/chat/js/ricoeffects.js" type="text/javascript"></script>
    <script src="<%=ctxpath%>/chat/js/ricobehaviors.js" type="text/javascript"></script>
    <script src="<%=ctxpath%>/chat/js/ricocomponents.js" type="text/javascript"></script>
    
  </head>
  <body  leftMargin="0" topMargin="0" marginwidth="0" marginheight="0" id="outlookbody"  scroll=no  onload="if(parent.folder != -1 && bResize==true){OutlookLikeBar.FolderClicked(parent.folder);bResize=false;}lastHeight = document.body.clientHeight;">
    <script language="javascript">
    <%
    String functionid=request.getParameter("functionid");
    boolean bAccreditLogin = session.getAttribute("originalLoginUserId") != null && session.getAttribute("originalLoginPassword") != null;
    MenuGenerator generator=new MenuGenerator();
    if(functionid!=null) {
      if(!bAccreditLogin){
        TreeNode node=sessionmng.getTreeNodeByID(functionid);
        if(node!=null) {
          
          out.println(generator.outlookbarGenerator(node,request.getContextPath()));
        }
      }else{
        String original = (String)session.getAttribute("originalLoginUserId");
        DB db = null;
        try {
          db = DBFactory.getDBInstance();
          AccreditAcl accreditAcl = new AccreditAcl(db);
          String accreditUserId = AccreditUtil.getStringValueByFieldName("select id from ORGMODEL_USERINFO where loginname='"+original+"'","id",db);
          Tree tree = accreditAcl.AclToTree(accreditAcl.getFunctionTree(false,true,false,sessionmng.getUserInfo().getID(),accreditUserId,new String[]{"using"},"user"));
          Enumeration enuChild=tree.getRoot().children();
          while(enuChild.hasMoreElements()) {
            TreeNode node=(TreeNode)enuChild.nextElement();
            FunctionInfo info=(FunctionInfo)node.getUserObject();
            if(Function.normalizeString(info.getId()).equals(functionid)){
              out.println(generator.outlookbarGenerator(node,request.getContextPath()));
            }
          }
          db.close();
        } catch(Exception e) {
        }
      }
    }
    %>
    
    var path='<%=currentStylePath%>';
    var OB_UpArrow=''+path+'arrowdown.gif';	//向上滚动的向下logo箭头
    var OB_DownArrow=''+path+'arrowup.gif';	//向下滚动的向上logo箭头
    var bButtonClick=false;
    
    if (document.all)
    {
    document.write('<script src="<%=ctxpath%>/javascript/outbar.js"><\/script>')
}


//if (navigator.appName.indexOf("Internet Explorer") != -1)
//	document.onmousedown = noright;

function noright()
{
	if (event.button == 2 | event.button == 3)
	{
		alert("");
//		location.replace("http://url");
//		history.go(0);
	}
}

var bLoad=true;
window.onresize = window_OnResize;
var lastHeight;
var bResize = false;
function window_OnResize()
{
    if(document.body.clientHeight != lastHeight){
        lastHeight = document.body.clientHeight;
        bResize = true;
        location.reload();
    }
}
    </script>
    
    
  </body>
  
  <%
  //加session的目的是解决有的时候显示不完整的问题
  
  String outlookbarreload = (String)session.getAttribute("outlookbarreload");
  if ((outlookbarreload == null) ||(outlookbarreload.equals(""))) {
  %>	
  <script >
    location.reload();
  </script>	
  <%
  session.setAttribute("outlookbarreload","true");
  }
  %>
</html>
